//////////////////////////////////////////////////////////////////////////
//
// GAM203
// Drawable
// Drawable.cpp
// 
// Grant Johnson
// Qantm College
// 27/10/2010
//
//////////////////////////////////////////////////////////////////////////

#include "Drawable.h"

Drawable::Drawable()
: m_pVertexBuffer(NULL)
, m_pIndexBuffer(NULL)
, m_blendEnabled(false) // No blending by default
, m_drawOverStencil(false) //Does not draw over stencil buffer by default
, m_isLightable(false)
, m_isLit(false)
{
	D3DXMatrixIdentity(&m_worldMatrix);
}

Drawable::~Drawable()
{
	//Clean up
	if(m_pVertexBuffer)
	{
		m_pVertexBuffer->Release();
		m_pVertexBuffer = NULL;
	}
	if(m_pIndexBuffer)
	{
		m_pIndexBuffer->Release();
		m_pIndexBuffer = NULL;
	}
}
void Drawable::SetWorldMatrix(const D3DXMATRIX& a_newWorldMat) 
{ 
	m_worldMatrix = a_newWorldMat;
}
const D3DXMATRIX& Drawable::GetWorldMatrix() const
{
	return m_worldMatrix; 
}
void Drawable::EnableBlending(bool a_val) 
{ 
	m_blendEnabled = a_val; 
}
void Drawable::SetDrawOverStencil(bool a_val) 
{ 
	m_drawOverStencil = a_val; 
}
bool Drawable::DoesDrawOverStencil() 
{ 
	return m_drawOverStencil; 
}

